{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li class="active"><a href="javascript:;">问题列表</a></li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="filter-action">
			<a class="btn btn-primary" href="{php echo web_url('helper/helperquestion/add');}">添加问题</a>
		</div>
	</div>
	<div class="app-table-list">
		<div class="table-responsive">
			<table class="table table-hover table-bordered">
				<thead>
				<tr>
					<th style="width:30px;" class="text-center"><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" /></th>
					<th class="text-center" style="width:40px;">排序</th>
					<th class="text-center" style="width:80px;">问题分类</th>
					<th class="text-center" style="width:150px;">问题名称</th>
					<th class="text-center" style="width:50px;">推荐</th>
					<th class="text-center" style="width:50px;">状态</th>
					<th class="text-center" style="width:80px;">操作</th>
				</tr>
				</thead>
				<tbody>
				{loop $list $item}
				<tr class="text-center">
					<td>
						<center><input type="checkbox" name="checkbox[]" class="checkbox" value="{$item['id']}" /></center>
					</td>
					<td>
						{$item['sort']}
					</td>
					<td>
						{loop $category $cate}
						{if intval($item['type'])==intval($cate['id'])}
						{$cate['name']}
						{/if}
						{/loop}
					</td>
					<td>
						{$item['title']}
					</td>
					<td>{if $item['recommend']==1}<span class="label label-primary">是</span>{else}<span class="label label-default">否</span>{/if}</td>
					<td>{if $item['status']==1}<span class="label label-primary">显示</span>{else}<span class="label label-default">隐藏</span>{/if}</td>
					<td style="position:relative;">
						<a href="{php echo web_url('helper/helperquestion/add',array('id'=>$item['id']))}">编辑</a>
						-
						<a href="{php echo web_url('helper/helperquestion/del',array('id'=>$item['id']))}">删除</a>
					</td>
				</tr>
				{/loop}
				</tbody>
			</table>
		</div>
	</div>

	<div class="app-table-foot clearfix">
		<div class="pull-left">
			<div id="de1">
				<a href="javascript:;" class="btn btn-default min-width js-batch js-delete">删除选中记录</a>
			</div>
		</div>
		<div class="pull-right">
			{$pager}
		</div>
	</div>

</div>
<script type="text/javascript">
	$('#de1').delegate('.js-delete', 'click', function(e) {
		e.stopPropagation();
		var order_ids = [];
		var $checks = $('.checkbox:checkbox:checked');
		$checks.each(function() {
			if(this.checked) {
				order_ids.push(this.value);
			};
		});
		var $this = $(this);
		var ids = order_ids;
		util.nailConfirm(this, function(state) {
			if(!state) return;
			$.post("{php echo web_url('helper/helperquestion/del')}", { ids: ids }, function(data) {
				if(!data.errno) {
					util.tips("删除成功！");
					location.reload();
				};
			}, 'json');
		}, { html: '确认删除?' });
	});
</script>
{php include wl_template('common/footer');}